package com.itheima.mapper;

import com.itheima.pojo.CheckItem;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @className CheckItemMapper
 */
@Mapper
public interface CheckItemMapper {

    @Insert("insert into t_checkitem(code, name, sex, age, price, type, attention, remark) VALUES " +
            "(#{code},#{name},#{sex},#{age},#{price},#{type},#{attention},#{remark})")
    void insertCheckItem(CheckItem checkItem); //添加检查项

    @Delete("delete from t_checkitem where id = #{id}")
    void deleteCheckItemById(Integer id); //删除检查项

    List<CheckItem> selectCheckItemByPage(String queryString); //分页查询

    void updateCheckItem(CheckItem checkItem); //修改检查项

    @Select("select * from t_checkitem where id = #{id}")
    CheckItem selectCheckItemById(Integer id); //根据id查询检查项

    @Select("select * from t_checkitem")
    List<CheckItem> selectAllCheckItem(); //查询所有检查项

    @Select("select checkitem_id from t_checkgroup_checkitem where checkgroup_id = #{groupId}")
    List<Integer> selectCheckItemIdsByGroupId(Integer groupId); //根据检查组id查询检查项id

    List<CheckItem> selectCheckItemsByIds(@Param("itemIds") List<Integer> itemIds); //根据检查项id查询检查项
}
